\begin{tikzpicture}
  [background rectangle/.style={fill=red!20},
  framed]
  \node at (-1,0) (l1) {quat(E)};
  \node [below=of l1,yshift=2.5em,xshift=-3em] (l2) {q\small{1}};
  \matrix [ matrix of nodes,nodes in empty cells,right=of l2,xshift=-2.6em] (l2r) {(if&res(E)&\_&\_&)\\};
  \node [below=of l2r.south,yshift=2.5em,xshift=-2.3em] (l3) {quat(S1)};
  \node [below=of l3,yshift=2.5em,xshift=-3em] (l4) {q\small{2}};
  \matrix [ matrix of nodes,nodes in empty cells,right=of l4,xshift=-2.6em] (l4r) {(el&\ \ \ \ \_\ \ \ \ &\_&\_&)\\};
  \node [below=of l4r.south,yshift=2.5em,xshift=-2.3em] (l5) {quat(S2)};
  \node [below=of l5,yshift=2.5em,xshift=-3em] (l6) {q\small{3}};
  \matrix [ matrix of nodes,nodes in empty cells,right=of l6,xshift=-2.6em] (l6r) {(ie&\ \ \ \ \_\ \ \ \ &\_&\_&)\\};
  \draw[-Latex,blue] ([yshift=0.2em]l2r-1-4.east) -- ([yshift=0.2em,xshift=2em]l2r-1-4.east) -- ([xshift=2em]l2r-1-4.east|-l5.east) -- ([xshift=2em]l5.east);
  \draw[-Latex,red] ([yshift=0.2em]l4r-1-4.east) -- ([yshift=0.2em,xshift=3em]l4r-1-4.east) -- ([xshift=3em]l4r-1-4.east|-l6r.east) -- ([xshift=0em]l6r.east);
\end{tikzpicture}